<ui:composition template="../../templates/template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="content-center">
		<h3>
			<h:outputText value="Configura&#231;&#227;o de perfil" />
		</h3>
		<p:separator />
		<br />
		<h:form id="formaltera">
			<p:panelGrid>
				<p:row>
					<p:column style="font-weight: bold;">
						<h:outputText value="Matricula" />
					</p:column>
					<p:column>
						<h:inputText value="#{controleBean.usuario.matricula}"
							disabled="true" size="#{controleBean.usuario.matricula.length()}" />
					</p:column>
				</p:row>
				<p:row>
					<p:column style="font-weight: bold;">
						<h:outputText value="Nome" />
					</p:column>
					<p:column>
						<h:inputText value="#{controleBean.usuario.nome}" disabled="true"
							size="#{controleBean.usuario.nome.length()}" />
					</p:column>
				</p:row>
				<p:row>
					<p:column style="font-weight: bold;">
						<h:outputText value="Senha" />
					</p:column>
					<p:column>
						<h:inputText value="#{controleBean.usuario.senha}" disabled="true"
							size="#{controleBean.usuario.senha.length()}" />
					</p:column>
				</p:row>
				<p:row>
					<p:column style="font-weight: bold;">
						<h:outputText value="E-mail" />
					</p:column>
					<p:column>
						<h:inputText value="#{controleBean.usuario.email}" disabled="true"
							size="#{controleBean.usuario.email.length()}" />
					</p:column>
				</p:row>
				<p:row>
					<p:column style="font-weight: bold;">
						<h:outputText value="Telefone" />
					</p:column>
					<p:column>
						<h:inputText value="#{controleBean.usuario.telefone}"
							size="#{controleBean.usuario.telefone.length()}" disabled="true" />
					</p:column>
				</p:row>
			</p:panelGrid>
			<p:commandButton value="Atualizar" onclick="dlg.show();" />
			<p:commandButton value="Alterar Senha" onclick="dlg1.show();" />
		</h:form>
	</ui:define>

	<ui:define name="dialogs">
		<h:form id="form1">
			<p:dialog header="Cadastro" widgetVar="dlg" resizable="false"
				draggable="false" closable="false" modal="true">

				<p:panelGrid columns="2">

					<h:outputLabel for="fullname" value="Nome Completo: " />
					<p:inputText id="fullname" value="#{controleBean.usuario.nome}"
						required="true"
						requiredMessage="O campo nome &#233; necess&#225;rio." size="30" />

					<h:outputLabel for="telephone" value="Telefone: " />
					<p:inputText id="telephone"
						value="#{controleBean.usuario.telefone}" required="true"
						requiredMessage="O campo telefone &#233; necess&#225;rio."
						size="13" />

					<h:outputLabel for="Email" value="E-mail: " />
					<p:inputText id="Email" value="#{controleBean.usuario.email}"
						required="true"
						requiredMessage="O campo e-mail &#233; necess&#225;rio." size="30" />

					<f:facet name="footer">
						<p:row>
							<p:column>
								<p:commandButton action="#{controleBean.updateUsuario}"
									update=":formaltera" value="Atualiza" icon="ui-icon-check"
									oncomplete="dlg.hide()" />
							</p:column>
							<p:column>
								<p:commandButton value="Cancela" onclick="dlg.hide()"
									icon="ui-icon-close" />
							</p:column>
						</p:row>
					</f:facet>
				</p:panelGrid>
			</p:dialog>
		</h:form>

		<h:form id="form2">
			<p:dialog header="Alterar Senha" widgetVar="dlg1" resizable="false"
				draggable="false" closable="false" modal="true">

				<p:panelGrid columns="2">

					<h:outputLabel for="pwd1" value="Nova Senha: " />
					<p:password id="pwd1" value="#{controleBean.usuario.senha}"
						match="pwd2" label="Password 1" required="true" />

					<h:outputLabel for="pwd2" value="Confirmar Senha: " />
					<p:password id="pwd2" value="#{controleBean.usuario.senha}"
						label="Password 2" required="true" />
					<f:facet name="footer">
						<p:row>
							<p:column>
								<p:commandButton action="#{controleBean.updateUsuario}"
									update=":formaltera" value="Atualiza" icon="ui-icon-check"
									oncomplete="dlg1.hide()" />
							</p:column>
							<p:column>
								<p:commandButton value="Cancela" onclick="dlg1.hide()"
									icon="ui-icon-close" />
							</p:column>
						</p:row>
					</f:facet>
				</p:panelGrid>
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>